<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<button>点我跳转</button>
		<input type="text" name="" id="" value="" />
		<button>点我后退</button>
		<button>cooke</button>
		<!--进度条-->
		<progress value="0" width="100px" height="20px" max="100"></progress>		
		<script type="text/javascript">
//			var btn = document.getElementsByTagName("button");
//			var input1 = document.getElementsByTagName("input")[0];
//			var inputValue = input1.value;
//			console.log(inputValue)
//			btn[0].onclick = function(){
//				var inputValue = input1.value; 
//			    location.href="系统对象.html?keyword="+inputValue;
//			}
//			//前进
//			btn[1].onclick = function(){
////				history.go(-1);
//				var inputValue = input1.value; 
//				var arr = [1,2,3,4,5];
//				localStorage.getItem("keyword",arr);
//			}
//			btn[2].onclick = function(){
//				var inputValue = input1.value; 
//				var d = new Date();
//				d.setTime(d.getTime()+60*1000);
//				document.cookie ="username="+inputValue+";Exoires="+d.toGMTString();
//			}
			var p = document.getElementsByTagName("progress")[0];
			var xhr = new XMLHttpRequest();
			var src = "http://zeroq.gitee.io/textmuic";
			xhr.open("get",src,true);
			xhr.send();
			xhr.addEventListener("readystatechange",function(e){
				var res = e.target;
				//等于4就是加载完成
				if(res.readyState==4){
					//完成加载好了
					if(res.state == 200){
						console.log("请求成功");
					}
				}
			})
			xhr.addEventListener("progress",function(e){
				if(e.lengthComputable){
					p.setAttribute("value",e.loaded);
					p.setAttribute("max",e.total);
				}
			})
			xhr.onload = function(event){
				//得到二进制类型文件后进行解码
				var date = xhr.response;
				audioContext.decodeAudioData(data,function(buffer){
					//创建内存音频资源
					var source = audioContext.createBufferSource();
					source.buffer = buffer;
					//链接
					source.connect(audioContext.destination);
					//循环
					source.loop=true;
					//播放
					source.start();
				},function(err){
//					console.log(err);
				})
			}
		</script>
	</body>
</html>
